namespace ResponseLocalLibrary
{
    using System;
    using ASBCC.Business;
    using IAM.Interface.Model;
    using System.Collections.Generic;

    public class IdentityManagement
    {
        public AccountInfo CreateIdentity(Identity identity)
        {
            AccountInfo info = new AccountInfo();
            info.HRISEID = identity.Accountinfo.HRISEID;
            info.ADAccount = identity.Accountinfo.ADAccount;
            info.CSLAccount = identity.Accountinfo.CSLAccount;
            info.CILX500 = identity.Accountinfo.CILX500;
            info.UPI = identity.Accountinfo.UPI;
            info.AppAccount = identity.Accountinfo.UPI;
            return info;


        }

        public AccountInfo DeleteIdentity(Identity identity)
        {
            AccountInfo info = new AccountInfo();
            info.HRISEID = identity.Accountinfo.HRISEID;
            info.ADAccount = identity.Accountinfo.ADAccount;
            info.CSLAccount = identity.Accountinfo.CSLAccount;
            info.CILX500 = identity.Accountinfo.CILX500;
            info.UPI = identity.Accountinfo.UPI;
            info.AppAccount = identity.Accountinfo.AppAccount;
            RoleAssignmentHelper helper = new RoleAssignmentHelper();
            helper.SetUserRoles(identity.Accountinfo.UPI, new List<int>(), "CCD", true);
            helper.SetUserRoles(identity.Accountinfo.UPI, new List<int>(), "CCO", true);
            helper.SetUserRoles(identity.Accountinfo.UPI, new List<int>(), "CIO", true);
            return info;
        }

        public AccountInfo DisableIdentity(Identity identity)
        {
            AccountInfo info = new AccountInfo();
            info.HRISEID = identity.Accountinfo.HRISEID;
            info.ADAccount = identity.Accountinfo.ADAccount;
            info.CSLAccount = identity.Accountinfo.CSLAccount;
            info.CILX500 = identity.Accountinfo.CILX500;
            info.UPI = identity.Accountinfo.UPI;
            info.AppAccount = identity.Accountinfo.UPI;
            RoleAssignmentHelper helper = new RoleAssignmentHelper();
            helper.SetUserRoles(identity.Accountinfo.UPI, new List<int>(), "CCD", true);
            helper.SetUserRoles(identity.Accountinfo.UPI, new List<int>(), "CCO", true);
            helper.SetUserRoles(identity.Accountinfo.UPI, new List<int>(), "CIO", true);
            return info;
        }

        public AccountInfo EnableIdentity(Identity identity)
        {
            AccountInfo info = new AccountInfo();
            info.HRISEID = identity.Accountinfo.HRISEID;
            info.ADAccount = identity.Accountinfo.ADAccount;
            info.CSLAccount = identity.Accountinfo.CSLAccount;
            info.CILX500 = identity.Accountinfo.CILX500;
            info.UPI = identity.Accountinfo.UPI;
            info.AppAccount = identity.Accountinfo.UPI;
            CCSFacade.EnableIdentity(identity.Accountinfo.UPI);
            return info;
        }

        public AccountInfo UpdateIdentity(Identity identity)
        {
            AccountInfo info = new AccountInfo();
            info.HRISEID = identity.Accountinfo.HRISEID;
            info.ADAccount = identity.Accountinfo.ADAccount;
            info.CSLAccount = identity.Accountinfo.CSLAccount;
            info.CILX500 = identity.Accountinfo.CILX500;
            info.UPI = identity.Accountinfo.UPI;
            info.AppAccount = identity.Accountinfo.AppAccount;
            return info;
        }
    }
}

